package sdk

import (
	// "fmt"

	// mspclient "github.com/hyperledger/fabric-sdk-go/pkg/client/msp"
	// "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt"
	"github.com/hyperledger/fabric-sdk-go/pkg/core/config"
	"github.com/hyperledger/fabric-sdk-go/pkg/fabsdk"
)

func Setup(configFile string) (*fabsdk.FabricSDK, error) {
	// Create SDK setup for the integration tests
	var err error
	sdk, err := fabsdk.New(config.FromFile(configFile))
	if err != nil {
		return nil, err
	}

	// // 为组织获得Client句柄和Context信息
	// for _, org := range info.Orgs {
	// 	org.orgMspClient, err = mspclient.New(sdk.Context(), mspclient.WithOrg(org.OrgName))
	// 	if err != nil {
	// 		return nil, err
	// 	}
	// 	orgContext := sdk.Context(fabsdk.WithUser(org.OrgAdminUser), fabsdk.WithOrg(org.OrgName))
	// 	org.OrgAdminClientContext = &orgContext

	// 	// New returns a resource management client instance.
	// 	resMgmtClient, err := resmgmt.New(orgContext)
	// 	if err != nil {
	// 		return nil, fmt.Errorf("根据指定的资源管理客户端Context创建通道管理客户端失败: %v", err)
	// 	}
	// 	org.OrgResMgmt = resMgmtClient
	// }

	// // 为Orderer获得Context信息
	// ordererClientContext := sdk.Context(fabsdk.WithUser(info.OrdererAdminUser), fabsdk.WithOrg(info.OrdererOrgName))
	// info.OrdererClientContext = &ordererClientContext
	return sdk, nil
}
